import java.util.Arrays;

public class 奇数在偶数的前面 {
    public static void main(String[] args) {
        int[] arr = {1,3,5,7,9};
        int i = 0;
        int j = arr.length-1;

        while (i<j) {
             if(arr[i]%2!=0) {
                 i++;
             }
             else {
                 if(arr[j]%2==0) {
                     j--;
                 }
                 else {
                     int tmp = arr[i];
                     arr[i] = arr[j];
                     arr[j] = tmp;
                 }
             }
        }
        System.out.println(Arrays.toString(arr));
    }
}
